home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 22 / PC Actual CD 22.iso / progs / Netobj / CDK / NetObjectsFusionCDK5_97.exe / _SETUP.1 / ExternalPictureComp.java < prev    next >
Encoding:
Java Source  |  1997-05-14  |  2.1 KB  |  86 lines

  1. import ComponentApp;
  2.  
  3. public class ExternalPictureComp extends ComponentApp
  4. {
  5.         DDrawPicture cdp;
  6.         String theSource;
  7.         String codebase;
  8.         DAssetManager assetMan;
  9.  
  10.         
  11.         public void onCopy()
  12.         {
  13.     
  14.         }
  15.         
  16.         public String onInstall(DAssetManager cam, String codebase) 
  17.         { 
  18.             assetMan=cam;
  19.             this.codebase=codebase;
  20.                 return "Picture Loader";
  21.         }
  22.  
  23.         public void onInspect(CStringArray Names,CStringArray Types)
  24.         {
  25.             Names.Set("Image URL");
  26.             Types.Set(typeString);
  27.         }
  28.  
  29.         public String PropertyListener(String Event,String Value,int Get, int propIndex, IDInspector insp) 
  30.         {
  31.                 if (Get == 1)
  32.                 {
  33.                         if (Event.compareTo("Image URL") == 0)
  34.                         {
  35.                                 return theSource;
  36.                         }
  37.                 }
  38.                 else
  39.                 {
  40.                         if (Event.compareTo("Image URL") == 0)
  41.                         {
  42.                                 theSource=Value;
  43.                                 if(!(theSource.indexOf(":")>0))
  44.                                 {
  45.                                     theSource="http://"+theSource;
  46.                                 }
  47.                         }    
  48.                         cdp.setHTMLBefore("<img src=\""+theSource+"\"><!--");
  49.                         cdp.setHTMLAfter("-->");
  50.                         cdp.setPictureText(theSource);
  51.                         cdp.Invalidate(true);
  52.                 }
  53.                 return "";
  54.         }
  55.  
  56.         protected void finalize() 
  57.         {
  58.         }
  59.             
  60.  
  61.         public void onDrop(IDLayout layout, IDRect r, int fDrop) 
  62.         {
  63.             //
  64.             // we only process drop for now
  65.             //
  66.         if (fDrop != ActivateState.Drop)
  67.             return;
  68.  
  69.           theSource="";
  70.           cdp = new DDrawPicture();
  71.           cdp.SetPositionRect(r.getLeft(), r.getTop(), r.getRight(), r.getBottom());
  72.           cdp.setStretch(PictureStretchMode.DRAW_STRETCHED);
  73.           cdp.setUsePictureText(true);
  74.           cdp.setPictureText("Picture Loader");
  75.           cdp.setImageFile(codebase + "ExternalPictureComp.gif");
  76.           layout.AddObject(cdp);
  77.         }
  78.         
  79.         public void onUnInstall(DAssetManager cam) 
  80.         {
  81.         }
  82.  
  83.         public void onPublish(DAssetManager asm, int context)
  84.         {
  85.         }
  86. }